#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>




void test1()
{
	int* ret = (int*)malloc(40);

	for (int i = 0; i < 10; i++)
	{
		ret[i] = i;

	}
	for (int i = 0; i < 10; i++)
	{
		printf("%d ", ret[i]);

	}
	printf("\n");

	free(ret);
	ret = NULL;
	

}


void test2()
{

	int* ret = (int*)calloc(10,4);

	for (int i = 0; i < 10; i++)
	{
		printf("%d ", ret[i]);

	}
	
	printf("\n");

	free(ret);
	ret = NULL;



}



void test3()
{

	int* ret = (int*)malloc(40);

	

	ret = (int*)realloc(ret, 48);

	for (int i = 0; i < 12; i++)
	{
		ret[i] = i;

	}


	for (int i = 0; i < 12; i++)
	{
		printf("%d ", ret[i]);

	}
	printf("\n");
	free(ret);
	ret = NULL;


}



void test4()
{
	int** str = (int*)malloc(sizeof(int*) * 3);

	int i = 0;
	for (i = 0; i < 3; i++)
	{
		str[i] = (int*)malloc(sizeof(int) * 5);
	}

	int j = 0;
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 5; j++)
		{
			str[i][j] = i + j;
		}

	}

	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 5; j++)
		{
			printf("%d ", str[i][j]);
		}
		printf("\n");
	}


}





int main()
{
	
	/*test1();
	test2();
	test3();*/
	test4();

	return 0;
}